﻿using System.Collections.Generic;
using BusinessObjects;
using BusinessObjects.BusinessRules;

namespace BusinessSecurity
{
    /// <summary>
    ///     Site
    /// </summary>
    public class Site : BusinessObject
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="Site" /> class.
        /// </summary>
        public Site()
        {
            AddRule(new ValidateId("Id"));
            AddRule(new ValidateLength("Title", 0, 255));
            PermissionInSites = new List<PermissionInSite>();
            Sites = new List<Site>();
            RoleInSites = new List<RoleInSite>();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Site" /> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="title">The title.</param>
        /// <param name="description">The description.</param>
        /// <param name="controller">The controller.</param>
        /// <param name="order">The order.</param>
        /// <param name="parentId">The parent identifier.</param>
        /// <param name="status">The status.</param>
        /// <param name="isGroup">The is group.</param>
        public Site(int id, string title, string description, string controller, int order, int? parentId, bool? status,
                    bool? isGroup)
        {
            Id = id;
            Title = title;
            Description = description;
            Controller = controller;
            Order = order;
            ParentId = parentId;
            Status = status;
            IsGroup = isGroup;
        }

        /// <summary>
        ///     Gets or sets the identifier.
        /// </summary>
        /// <value>
        ///     The identifier.
        /// </value>
        public int Id { get; set; }

        /// <summary>
        ///     Gets or sets the title.
        /// </summary>
        /// <value>
        ///     The title.
        /// </value>
        public string Title { get; set; }

        /// <summary>
        ///     Gets or sets the description.
        /// </summary>
        /// <value>
        ///     The description.
        /// </value>
        public string Description { get; set; }

        /// <summary>
        ///     Gets or sets the order.
        /// </summary>
        /// <value>
        ///     The order.
        /// </value>
        public int Order { get; set; }


        /// <summary>
        /// Gets or sets the controller.
        /// </summary>
        /// <value>
        /// The controller.
        /// </value>
        public string Controller { get; set; }

        /// <summary>
        ///     Gets or sets the parent identifier.
        /// </summary>
        /// <value>
        ///     The parent identifier.
        /// </value>
        public int? ParentId { get; set; }

        /// <summary>
        ///     Gets or sets the status.
        /// </summary>
        /// <value>
        ///     The status.
        /// </value>
        public bool? Status { get; set; }

        /// <summary>
        ///     Gets or sets the is group.
        /// </summary>
        /// <value>
        ///     The is group.
        /// </value>
        public bool? IsGroup { get; set; }

        /// <summary>
        ///     Gets or sets the permission in sites.
        /// </summary>
        /// <value>
        ///     The permission in sites.
        /// </value>
        public List<PermissionInSite> PermissionInSites { get; set; }

        /// <summary>
        ///     Gets or sets the sites.
        /// </summary>
        /// <value>
        ///     The sites.
        /// </value>
        public List<Site> Sites { get; set; }

        /// <summary>
        ///     Gets or sets the role in sites.
        /// </summary>
        /// <value>
        ///     The role in sites.
        /// </value>
        public List<RoleInSite> RoleInSites { get; set; }
    }
}